﻿﻿<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<title>个人博客用户登录注册</title> 
<meta name="keywords" content="网站模板下载,网站后台登录模板,后台登录模板HTML,后台模板登录,后台登录模板下载" />
<meta name="description" content="素材吧提供大量的网站后台模板下载以及手机网站模板下载" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="js/jquery-1.9.0.min.js"></script>
<script type="text/javascript" src="images/login.js"></script>
<link href="css/login2.css" rel="stylesheet" type="text/css" />
</head>
<body> 
<h1>登陆注册<sup>V2019</sup></h1>

<div class="login" style="margin-top:50px;">
    
    <div class="header">
        <div class="switch" id="switch"><a class="switch_btn_focus" id="switch_qlogin" href="javascript:void(0);" tabindex="7">快速登录</a>
			<a class="switch_btn" id="switch_login" tabindex="8" href="javascript:void(0);">快速注册</a><div class="switch_bottom" id="switch_bottom" style="position: absolute; width: 64px; left: 0px;"></div>
        </div>
    </div>    
    <div class="web_qr_login" id="web_qr_login" style="display: block; height: 235px;">    

            <!--登录-->
            <div class="web_login" id="web_login">
               
               
               <div class="login-box">
    
            
			<div class="login_form" id="usertype" data-type="${user.getU_type().getU_tid()}" data-state="${user.u_state}">
				<form  name="loginform" accept-charset="utf-8" id="loginsubmit" class="loginForm" method="post"><input type="hidden" name="did" value="0"/>
               <input type="hidden" name="to" value="log"/>
                <div class="uinArea" id="uinArea">
                <label class="input-tips" for="u">帐号：</label>
                <div class="inputOuter" id="uArea">
                    
                    <input type="text" id="u" name="u_id"  class="inputstyle"/><span id="us" style="display:none; color: red;" >用户名不能为空</span>
                </div>
                </div>
                <div class="pwdArea" id="pwdArea">
               <label class="input-tips" for="p">密码：</label> 
               <div class="inputOuter" id="pArea">
                    <input type="password" id="p" name="u_password" class="inputstyle"/>
                    <span id="ps" style="display:none; color: red;" >密码不能为空</span>
                </div>
                </div>
               
                
                <div style="padding-left:50px;margin-top:20px;"><input type="submit" value="登 录" style="width:150px;" class="button_blue"/></div>
             	
                <a href="indexs">管理员登录</a>
              </form>
           </div>
           
            	</div>
               
            </div>
            <!--登录end-->
  </div>
<script type="text/javascript" src="js/jquery-1.8.3.js"></script>
	<!-- <script type="text/javascript" src="static/layui/layui.js"></script> -->
	<script type="text/javascript">
		$(function() {
			$('#u').blur(function(){
				
				if($('#u').val()!=''){
					$('#us').css({"display":"none"});
					
				}else{
					$('#us').css({"display":"block"});
					return false;
				}
			})
			$('#p').blur(function(){
				
				if($('#p').val()!=''){
					$('#ps').css({"display":"none"});
					
				}else{
					$('#ps').css({"display":"block"});
					return false;
				}
			})
			$("#loginsubmit").submit(function() {
				$.post("login",{
					"u_name" : $('input[name="u_id"]').val(),
					"u_password" : $('input[name="u_password"]').val()
				}, function(resp) {
					if(resp){
					if(resp.u_state==0){
						alert("该账号已经被冻结");
						return false;
					}
					alert("登陆成功！");
					if(resp.u_type.u_tid==1){
						location.href = "index";
					}else{
						alert('尊敬的管理员，你好！');
						location.href = "HT";
					}
					
					} else {
						alert("账号或密码错误!");
						$('input[name="u_id"]').val("");
						$('input[name="u_password"]').val("");
						$('input[name="u_id"]').focus();
					}
				});
				//阻止表单的默认提交行为
				return false;
			});
		})
	</script>
  <!--注册-->
    <div class="qlogin" id="qlogin" style="display: none; ">
   
    <div class="web_login">
    <form name="form2" id="registerkey" method="post" >
	      <input type="hidden" name="to" value="reg"/>
		      		       <input type="hidden" name="did" value="0"/>
        <ul class="reg_form" id="reg-ul">
        		<div id="userCue" class="cue">快速注册请注意格式</div>
                <li>
                    <label for="user"  class="input-tips2">用户名：</label>
                    <div class="inputOuter2">
                        <input type="text" id="user" name="u_name" maxlength="16" class="inputstyle2"/><span id="yonghuname" style="display:none; color: red;" >该用户已存在</span>
                    </div>
                </li>
                <li>
                <label for="passwd" class="input-tips2">密码：</label>
                    <div class="inputOuter2">
                        <input type="password" id="passwd"  name="u_password" maxlength="16" class="inputstyle2"/>
                    </div>
                </li>
                <label>男</label>
  				<input type="radio" name="u_gender" value="男">
				<label>女</label>
				<input type="radio" name="u_gender" value="女">
                <li>
                <label for="u_age" class="input-tips2">年龄：</label>
                    <div class="inputOuter2">
                        <input type="text" id="u_age" name="u_age" maxlength="16" class="u_age" />
                    </div>
                </li>
                <li>
                 <label for="u_phone" class="input-tips2">电话：</label>
                    <div class="inputOuter2">
                        <input type="text" id="u_phone" name="u_phone" maxlength="10" class="inputstyle2"/>
                    </div>
                </li>
                <li>
                 <label for="u_email" class="input-tips2">电子邮箱：</label>
                    <div class="inputOuter2">
                        <input type="text" id="u_email" name="u_email" maxlength="10" class="inputstyle2"/>
                    </div>
                </li>
                <li>
                 <label for="u_introduction" class="input-tips2">个人介绍：</label>
                    <div class="inputOuter2">
                        <input type="text" id="u_introduction" name="u_introduction" maxlength="10" class="inputstyle2"/>
                    </div>
                </li>
                <li>
                 <label for="u_hobby" class="input-tips2">个人爱好：</label>
                    <div class="inputOuter2">
                        <input type="text" id="u_hobby" name="u_hobby" maxlength="10" class="inputstyle2"/>
                    </div>
                </li>
                <li>
                    <div class="inputArea">
                        <input type="submit" id="reg"  style="margin-top:10px;margin-left:85px;" class="button_blue" value="同意协议并注册"/> <a href="http://www.sucai888.com/" class="zcxy" target="_blank">注册协议</a>
                    </div>
                </li><div class="cl"></div>
                <div class="cl"></div>
            </ul></form>
    </div>
    </div>
    <!--注册end-->
</div>
<div class="jianyi">*推荐使用ie8或以上版本ie浏览器或Chrome内核浏览器访问本站</div>


<script type="text/javascript">
$(function() {
	
	$('#user').blur(function(){
		var formdata = new FormData();
		formdata.append('u_name',$('#user').val());
		$.ajax({
			url : 'panduan',
			type : 'POST',
			data : formdata,
			dataType : 'JSON',
			cache : false,
			processData : false,
			contentType : false,
			success:function (resp) {
				if(resp){
					$('#yonghuname').css({"display":"none"});
					$("#registerkey").submit(function() {
						console.log(1);
						alert('ds');
						$.post("register", {
							"u_name" : $('input[name="u_name"]').val(),
							"u_password" : $('#passwd').val(),
							"u_gender" : $('input:radio[name="u_gender"]:checked').val(),
							"u_age" : $('input[name="u_age"]').val(),
							"u_phone" : $('input[name="u_phone"]').val(),
							"u_email" : $('input[name="u_email"]').val(),
							"u_introduction" : $('input[name="u_introduction"]').val(),
							"u_hobby" : $('input[name="u_hobby"]').val()
						}, function(resp) {
							if (resp) {
								alert("注册成功！");
								location.href = "index.jsp";
							} else {
								alert("注册失败！");
								$('input[name="u_id"]').val("");
								$('input[name="u_password"]').val("");
								$('input[name="u_id"]').focus();
							}
						});
						//阻止表单的默认提交行为
						return false;
					});
				}else{
					$('#yonghuname').css({"display":"block"});
					return false;
				}
				
				//console.log(resp)
				/* var html = '';
					//console.log(val);
					html+='<div Style="float:right">留言人：'+val.c_fromuserId.u_name+'</div>'
					+'<div Style="float:right">'+date.Format("yyyy-MM-dd")+'</div>'+'<div>'+val.c_content+'</div>';
				
				$('.chatBox-content-demo').empty();
				$('.chatBox-content-demo').append(html); */
			}
		})
		
	})
	
	
	/* $("#registerkey").submit(function() {
		if($('input[name="u_id"]').val()==null){
			alert('用户名为空');
		}
		if($('input[name="u_password"]').val()==null){
			alert('密码为空');
		}
		if($('input[name="u_gender"]').val()==null){
			alert('性别为空');
		}
		if($('input[name="u_age"]').val()==null){
			alert('年龄为空');
		}
		if($('input[name="u_phone"]').val()==null){
			alert('电话号码为空');
		}
		if($('input[name="u_email"]').val()==null){
			alert('电子邮箱为空');
		}
		if($('input[name="u_introduction"]').val()==null){
			alert('个人介绍为空');
		}
		if($('input[name="u_hobby"]').val()==null){
			alert('个人爱好为空');
		}
	)}; */
})
</script>
</div>
</body></html>